package com.nftturbo.base.pool;

import com.google.common.util.concurrent.ThreadFactoryBuilder;

import java.util.concurrent.*;

/**
 * 线程池工具
 *
 * @author 11522
 * @since 2024/7/14 2:11
 **/
public class ThreadPoolUtils {
    private static ThreadFactory smsThreadFactory = new ThreadFactoryBuilder()
            .setNameFormat("demo-pool-%d").build();

    private static ExecutorService smsThreadPool =new ThreadPoolExecutor(
            5,
            20,
            0L,
            TimeUnit.MILLISECONDS,
            new LinkedBlockingQueue<>(1000),
            smsThreadFactory,
            new ThreadPoolExecutor.AbortPolicy());

    public static ExecutorService getSmsThreadPool() {
        return smsThreadPool;
    }
}
